<template>
  <div class="common-body-wrapper">
    <search-header single-width="130" :searchList="searchList" @changeHeight="toRetTable" @confirmSearch="toSearch" @handleChange="handleSearchChange" :isSetSingle="false" :isCanSwitchStatus="false"></search-header>

    <div class="charts-wrap">
      <div class="header-title">
        <h3>
          <span>2018年11月08日</span>
          <span class="middle">[瀚天科技城]</span>
          <span>车场周转率:&nbsp;18.8次</span>
        </h3>
      </div>
      <div class="charts-body">
        <div class="body-left">
          <!-- 收入构成 -->
          <div class="income-form-wrap">
            <div id="income-form-echart" class="income-form-echart"></div>
            <div class="echart-bottom">
              <p>
                <span>临停</span>
                <span>100.00%</span>
                <span>0.04</span>
              </p>
              <p>
                <span>月票</span>
                <span>0.00%</span>
                <span>0</span>
              </p>
              <p>
                <span>优惠券</span>
                <span>0.00%</span>
                <span>0</span>
              </p>
            </div>
          </div>
          <!-- 收入趋势 -->
          <div class="income-trend-wrap">
            <div id="income-trend-echart" class="income-trend-echart"></div>
          </div>
        </div>
        <div class="body-right">
          <div class="tab-box">
            <span class="active">临停收入</span>
            <span>月票收入</span>
            <span>商家券收入</span>
          </div>
          <!-- 年报 -->
          <div class="year-report-box" v-if="true">
            <div class="parking-lot-name">
              停车场:&nbsp;瀚天科技城
            </div>
            <div class="tip-box">
              <span>{{year}}年</span>
              <span>单位:&nbsp;(元)</span>
            </div>
            <table class="year-report">
              <tbody>
                <tr>
                  <td><span>1月</span><span>￥500.80</span></td>
                  <td><span>2月</span><span>￥500.80</span></td>
                  <td><span>3月</span><span>￥500.80</span></td>
                </tr>
                <tr>
                  <td><span>4月</span><span>￥500.80</span></td>
                  <td><span>5月</span><span>￥500.80</span></td>
                  <td><span>6月</span><span>￥500.80</span></td>
                </tr>
                <tr>
                  <td><span>7月</span><span>￥500.80</span></td>
                  <td><span>8月</span><span>￥500.80</span></td>
                  <td><span>9月</span><span>￥500.80</span></td>
                </tr>
                <tr>
                  <td><span>10月</span><span>￥500.80</span></td>
                  <td><span>11月</span><span>￥500.80</span></td>
                  <td><span>12月</span><span>￥500.80</span></td>
                </tr>
              </tbody>
            </table>
            <div class="year-report-footer">
              合计:&nbsp;￥20389.96
            </div>
          </div>
          <!-- 月报 -->
          <div class="month-report-box" v-if="false">
            <div class="tip-box">
              <span>{{year}}年{{month}}月</span>
              <span>单位:&nbsp;(元)</span>
            </div>
            <table class="month-report">
              <thead>
                <tr>
                  <th>周日</th><th>周一</th><th>周二</th>
                  <th>周三</th><th>周四</th><th>周五</th><th>周六</th>
                </tr>
              </thead>
              <tbody>
                <tr v-for="item in calendarListObj">
                  <td v-for="i in item" :class="{'grayTd':i.money=='-'}">
                    <span>{{i.day}}</span>
                    <span v-if="i.money!='-'">￥{{i.money}}</span>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import stardardList from "@mixins/tables/stardardList.js";
  import oprating_finance_report from "./js/operatingFinanceReport.js";
  
  export default {
    mixins: [stardardList,oprating_finance_report],
    data() {
      var month = new Date(moment().subtract(1, 'months').format("YYYY-MM-DD 00:00:00"));
      return{
        searchList: [
           {
            index: 0,
            isShow: false,
            type: "datePicker",
            name: "query_chargeDate",
            text: "时间",
            value: month,
            format: "yyyy-MM",
            flag: 'month',
            pickerType: "month",
            isSingle: true,
            style: { width: "200px" }
          },
          {
            index: 1,
            isShow: false,
            type: "select",
            name: "reportDimension",
            text: "时间维度",
            value: "month",
            isHandleChange: true,
            options: [
              { name: "月报", value: "month" },
              { name: "年报", value: "year" }
            ]
          },
          {
            index: 2,
            isShow: false,
            type: "select",
            name: "parkId",
            text: "停车场名称",
            value: "",
            options: []
          }
        ]
      }
    }
  }
</script>

<style lang="less" scoped>
  .charts-wrap{
    overflow: auto;
    .header-title{
      margin: 20px 0;
      text-align: center;
      .middle{
        margin: 0 10px;
      }
    }
    .charts-body{
      display: flex;
      background: #F1F1F1;
      margin-left: 20px;
      margin-right: 20px;
      padding: 20px;
      .body-left,.body-right{
        height: 700px;
        background: #FFFFFF;
      }
      .body-right{
        flex: 1;
      }
      .body-left{
        width: 390px;
        margin-right: 20px;
        background: #F1F1F1;
        .income-form-wrap,.income-trend-wrap{
          height: 48.5%;
          background: #FFFFFF;
          .income-trend-echart{
            height: 260px;
          }
        }
        .income-trend-wrap{
          padding: 20px;
        }
        .income-form-wrap{
          margin-bottom: 20px;
          padding: 20px;
          .income-form-echart{
            height: 150px;
          }
          .echart-bottom{
            height: 100px;
            background: #f3f2f2;
            display: flex;
            flex-direction: column;
            padding: 10px;
            p{
              flex: 1;
              display: flex;
              justify-content: space-between;
              span:first-child{
                &:before{
                  content: " ";
                  width: 11px;
                  height: 11px;
                  display: inline-flex;
                  margin-right: 10px;
                }
              }
              &:first-child{
                span:first-child{
                  &:before{
                    background: #e57359;
                  }
                }
              }
              &:nth-child(2){
                span:first-child{
                  &:before{
                    background: #fb7da3;
                  }
                }
              }
              &:nth-child(3){
                span:first-child{
                  &:before{
                    background: #26a3fc;
                  }
                }
              }
            }
          }
        }
      }
      .body-right{
        .tab-box{
          height: 50px;
          line-height: 50px;
          display: flex;
          border-radius: 4px 4px 0 0;
          span{
            flex: 1;
            background: #69B8CE;
            text-align: center;
            font-size: 14px;
            color: #FFFFFF;
            cursor: pointer;
            &.active{
              background: #3F9AB3;
            }
          }
        }
        .parking-lot-name{
          padding-left:10px;
          height: 30px;
          line-height: 30px;
          font-size: 16px;
          color: #272727;
          font-weight: bold;
        }
        .tip-box{
          display: flex;
          justify-content: space-between;
          padding: 0 15px;
          height: 30px;
          line-height: 30px;
          span{
            cursor: pointer;
            &:first-child{
              font-size: 16px;
              color: #272727;
              font-weight: bold;
            }
          }
        }
        .month-report-box{
          .month-report{
            height: auto;
            tbody{
              tr td{
                border: 1px solid #DDDDDD;
                width: 98px;
                height: 90px;
                span{
                  text-align: center;
                  display: block;
                  &:first-child{
                    font-size: 14px;
                    color: #272727;
                  }
                  &:nth-child(2){
                    font-size: 16px;
                    color: #4C9FB6;
                  }
                }
                &.grayTd{
                  span{
                    color: #DDDDDD;
                  }
                }
              }
            }
          }
        }
        table{
          width: 100%;
          padding: 0 15px;
          &.year-report{
            height: 400px;
            tbody{
              tr td{
                border: 1px solid #DDDDDD;
                width: 228px;
                height: 100px;
                span{
                  text-align: center;
                  display: block;
                  &:first-child{
                    font-size: 14px;
                    color: #272727;
                  }
                  &:nth-child(2){
                    font-size: 16px;
                    color: #4C9FB6;
                  }
                }
              }
            }
          }
        }
        .year-report-footer{
          height: 44px;
          line-height: 44px;
          border: 1px solid #DDDDDD;
          text-align: center;
          font-size: 16px;
          margin: 0 15px;
        }
      }
    }
  }
</style>
